#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
using namespace std;


class Solution
{
public:
	vector<int> twoSum(vector<int>& nums,int target)
	{
		int left = 0, right = nums.size() - 1;
		while (left < right)
		{
			int sum = nums[left] + nums[right];
		
				if (sum > target)
					left++;
				else if (sum < target)
					right--;
				else
					return { nums[left],nums[right] };
		}
	}
};

int main()
{
	vector<int> v ;
	v.push_back(2);
	v.push_back(7);
	v.push_back(9);
	v.push_back(10);
	Solution s;
	vector<int> v2 = s.twoSum(v, 9);

	return 0;
}